<template>
  <div class="page">
    <div class="list" v-if="list.length">
      <van-panel
        v-for="item in list"
        :key="item.groupStartTime"
        :title="item.groupStartTime"
        status="拼团中"
      >
        <group-goods :item="item" @click="link(item.productID)" />
      </van-panel>
    </div>
    <!-- <van-panel title=" " status="已完成" @click="link">
      <goods :item="item"></goods>
    </van-panel>
    <van-panel title=" " status="拼团失败" @click="link">
      <goods :item="item"></goods>
    </van-panel>-->
  </div>
</template>

<script>
import GroupGoods from '@/components/GroupGoods.vue'
import { getMyGroupBuy } from '@/api'
import mixin from '@/mixin'

export default {
  name: 'my-group',
  mixins: [mixin],
  components: {
    GroupGoods
  },
  data() {
    return {
      active: '全部',
      list: []
    }
  },
  created() {
    this.getData()
  },
  methods: {
    getData() {
      getMyGroupBuy().then(res => {
        this.list = res
        console.log({ ...res })
      })
    },
    link(id) {
      this.$router.push(`/goods-detail/${id}`)
    }
  }
}
</script>
<style scoped lang="stylus" rel="stylesheet/stylus">
@import '../style/mixin'
.van-panel
  margin-bottom $part-width
.van-cell__title
  flex auto
</style>
